<template>
  <div>
    <ul>
      <li v-for="(item, index) in arr" :key="index">
        {{ item }}
        <button @click="handleClick(index)">删除</button>
      </li>
    </ul>
    <button @click="generator">生成</button>
  </div>
</template>

<script>
export default {
  name: 'Jjjj',
  components: {},
  data() {
    return {
      arr: [1, 5, 3],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    handleClick(index) {
      this.arr.splice(index, 1)
    },
    generator() {
      this.arr.push(this.randomNum(1, 100))
    },
    randomNum(min, max) {
      min = Math.max(min)
      max = Math.min(max)
      return Math.floor(Math.random() * (max - min)) + min
    },
  },
}
</script>

<style lang="less" scoped></style>
